<%@ page import="java.util.List" %>
<%@ page import="pojoCla.NewsChnl" %><%--
  Created by IntelliJ IDEA.
  User: zhazha
  Date: 2021/9/1
  Time: 11:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <link href="../css/main.css" rel="stylesheet">
    <%
        Object user = session.getAttribute("user");
        if(user == null){
            response.sendRedirect("../login.jsp");
            return;
        }
    %>
</head>
<body>
<!-- 栏目管理 -->
<div class="AccountManagement_c" id="ColumnManagement_c">
    <h3>栏目管理
        <div class="amcl fr">
            <input type="text" placeholder="栏目名" class="fl" name="" id="selChnl" value="${sessionScope.selChnlName}">
            <div class="search fl" id="searchChnl"><img src="../images/search.png"></div>
        </div>
    </h3>
    <div class="AM_ct text_center">
        <div class="AM_ct_in">
            <div class="add_btn df_btn fl" id="add_column_btn">添加</div>
            <div class="edit_btn df_btn fl" id="edit_column_btn">编辑</div>
            <div class="delete_btn df_btn fl" id="delete_column_btn">删除</div>
        </div>
    </div>

    <div class="list">
        <ul class="list_h">
            <li class="b20"><label><span>代号</span></label></li>
            <li class="b80"><label>栏目名称</label></li>
        </ul>
        <div class="list_b_c">
            <%
                List<NewsChnl> chnlList = (List<NewsChnl>) session.getAttribute("chnlPageList");
                if(chnlList.size() > 0){
                    for(NewsChnl chnl: chnlList){
                    %>
            <ul class="list_b">
                <li class="b20"><label><input type="checkbox" name="chnl"><span><%=chnl.getCode() %></span><input type="hidden"  value="<%=chnl.getId()%>"></label></li>
                <li class="b80"><label name="chnlName"><%=chnl.getName()%></label></li>
            </ul>
            <%
                    }
                }else {
                    %>
            <ul class="list_null">
                <li class="text_center">未添加栏目！</li>
            </ul>
            <%
                    }
            %>

        </div>

        <div class="pull_page" id="chnlPage">
            <div class="fl pull_page_up" name="1">首页</div>
            <ul>
                <li name="${sessionScope.chnlPageIndex - 1}">上一页</li>
                <li class="on">${sessionScope.chnlPageIndex}</li>
                <li name="${sessionScope.chnlPageIndex + 1}">下一页</li>
            </ul>
            <div class="fl pull_page_down" name="${sessionScope.chnlSumPage}">末页</div>&nbsp;
            <span class="pull_page_down">总页数:${sessionScope.chnlSumPage}</span>
        </div>
    </div>
</div>


<!-- 添加栏目 -->
<div class="add_Account dn" id="add_column">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                添加栏目
                <span class="fr add_Account_close"><img src="../images/close.png"></span>
            </div>
        </div>
        <div class="user_name user_i">
            <label>栏目名</label> <input type="text" placeholder="输入栏目名" name="" id="addChnlName" value=""><br>
            <span style="color: red"></span>
        </div>
        <div class="user_password user_i">
            <label>代<i>调</i>号</label> <input type="text" placeholder="输入代号" name="" id="addChnlNum" value=""><br>
            <span style="color: red"></span>
        </div>
        <div class="add_Account_ok_btn text_center" id="add_column_ok_btn">确<i>皮</i>定</div>
    </div>
</div>

<!-- 编辑栏目 -->
<div class="add_Account dn" id="edit_column">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                编辑栏目
                <span class="fr add_Account_close"><img src="../images/close.png"></span>
            </div>
        </div>
        <div class="user_name user_i">
            <label>栏目名</label> <input type="text" placeholder="输入栏目名" name="" id="editChnlName"><br>
            <span style="color: red"></span>
        </div>
        <div class="user_password user_i">
            <label>序<i>调</i>号</label> <input type="text" placeholder="输入序号" name="" id="editChnlNum"><br>
            <span style="color: red"></span>
        </div>
        <div class="add_Account_ok_btn text_center" id="edit_column_ok_btn">确<i>皮</i>定</div>
    </div>
</div>

<!-- 删除栏目 -->
<div class="add_Account dn" id="delete_column">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                删除栏目
                <span class="fr add_Account_close"><img src="../images/close.png"></span>
            </div>
        </div>
        <div class="delete_text">确定删除“ <span id="delChnl"></span> ”栏目吗？</div>
        <div class="add_Account_ok_btn text_center" id="delete_column_ok_btn">确<i>皮</i>定</div>
    </div>
</div>

</body>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/main.js"></script>
<script type="text/javascript">
    var addChnlMSG = "${sessionScope.addChnlMSG}";
    var delChnlMSG = "${sessionScope.delChnlMSG}";
    var editChnlMSG ="${sessionScope.editChnlMSG}";
    if(addChnlMSG != ""){
        alert(addChnlMSG);
    }else if(delChnlMSG != ""){
        alert(delChnlMSG);
    }else if(editChnlMSG != ""){
        alert(editChnlMSG);
    }
    <%
    session.removeAttribute("addChnlMSG");
    session.removeAttribute("delChnlMSG");
    session.removeAttribute("editChnlMSG");
    %>
</script>
</html>
